import React, { Component } from 'react'
import { HashRouter, Route, Redirect, Switch } from 'react-router-dom'
import CityList from './pages/CityList'  // 引入详情页
import Home from './pages/Home'    // 引入首页
import Cannet from './pages/Cannat' // 引入找不到页面
import MyMap from './pages/MyMap'
import './assets/fonts/iconfont.css' // 引入图标样式
export default class App extends Component {
  render() {
    return (
      <HashRouter>
        <Switch>
          {/* 重定向路由 匹配到 / 就跳转到首页 */}
          <Route exact path='/' render={() => <Redirect to='home' />} />
          <Route path='/home' component={Home} />
          <Route path='/citylist' component={CityList} />
          <Route path='/map' component={MyMap} />
          {/* 匹配路由找不到的页面  还需要通过switch 包住路由 */}
          <Route path='*' component={Cannet} />
        </Switch>
      </HashRouter>
    )
  }
}
